$(document).ready(function(){
	$("#username").focus();
	//用户名文本框回车事件
	$("#username").keyup(function(){
        if(event.keyCode == 13){
        	$("#password").focus();
        }
    });
    //密码文本框回车事件
	$("#password").keyup(function(){
        if(event.keyCode == 13){
        	login();
        }
    });
});

function login() {

    var jsondata =
    {
        "username": $("#username").val(),
        "password": $("#password").val()
    };
    $.ajax(
        {
            type: "POST",
            url: "/platform/windows/user/dologin",
            data: jsondata,
            dataType: "json",
            async: false,
            success: function (data) {
                if (data.message == "ok") {
                    window.location.href = getWebRootPath() + "/windows/index.html";
                }
                else {
                    window.location.href = getWebRootPath() + "/windows/login.html";
                }
            }
        });

}